PASSWORD:=test
debugging:=false
debugging:=true
app:=zhenbang
CERT:=my.p12
ISVERT:=true
ISVERT:=false

AS:= test.as
ifeq ($(ISVERT),true)
else
endif


ifneq ($(OS),Windows_NT)
OS:=$(shell uname)
NOT_LINUX:=false
else
HOME:= e:/Documents
HOME:=D:
NOT_LINUX=true
debugging:=false
FLEX_HOME:=$(HOME)/air29
BUNDLE:=../../yonghe_bundle
endif

ifeq ($(debugging),false)
PUBLISH:=false
else
PUBLISH:=true
endif

SWF_DIR := ../../bin
SOURCE_PATH :=..
ASSET := -C $(SWF_DIR) zhenbang.swf yonghe
ifeq ($(OS),Linux)
FLEX_HOME:=$(HOME)/flex_sdk_4.5
APP_XML:= test-app.xml
else
APP_XML:= ../../application.xml
endif
ADL:= $(FLEX_HOME)/bin/adl
ADT:=$(FLEX_HOME)/bin/adt
AMXMLC:= $(FLEX_HOME)/bin/amxmlc
SWC :=../jpeg.swc
SWF :=$(SWF_DIR)/$(app).swf
RM:=rm -rf
FLAGS:= -define=CONFIG::NOT_LINUX,$(NOT_LINUX)\
	-define=CONFIG::debugging,$(debugging)\
	-define=CONFIG::ISVERT,$(ISVERT)\

all: $(SWF)
	$(ADL) $(APP_XML) $(SWF_DIR)
ifeq ($(debugging),false)
ifeq ($(ISVERT),true)
	cp $(SWF) ../../shu/
else
	cp $(SWF) ../../heng/
endif
endif

$(SWF): *.as
	$(AMXMLC)  -strict=true -tools-locale en_US -omit-trace-statements=$(PUBLISH) -verbose-stacktraces=$(PUBLISH) $(AS) $(FLAGS) -source-path=$(SOURCE_PATH) -debug=$(debugging) -output $(SWF) -library-path+=$(SWC)

exe: $(SWF) $(CERT)
	$(ADT)  -package -storetype pkcs12 -keystore $(CERT) -storepass $(PASSWORD) -target bundle $(BUNDLE) $(APP_XML) $(ASSET) 
#	zip $(BUNDLE).zip -r $(BUNDLE)

$(CERT):
	$(ADT) -certificate -cn db0@qq.com -ou db0@qq.com -o db0@qq.com -c CN -validityPeriod 1 2048-RSA $(CERT) $(PASSWORD)

.PHONY : clean
clean:
	$(RM) $(SWF_DIR)/yonghe/images/ $(SWF_DIR)/data
